<?php $this->featured(); ?>
<article id="mainContain" class="wrapper">
	<section class="floatLeft" id="lastestPost">
		<?php foreach($posts as $post) : ?>
			<?php if($this->CategoryModel->isCategoryReview($post['id'])) : ?>
			<div id="newItem-<?php echo $post['id']; ?>" class="lastItems review">
				<div class="reviewInfo floatLeft">
					<h1><a href="<?php echo $post['permalink']; ?>" title=""><?php echo $post['title']; ?></a></h1>
						<?php if(has_post_thumbnail($post['id'])) : ?>
							<?php $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post['id']),'full'); ?>

							<img src="<?php echo CORE_TIMTHUMB_URL.$thumb[0]."&w=215&h=150";?>" alt="<?php echo $post['title']; ?>">
					<?php else : ?>
						<?php $thumbMeta = get_post_meta($post['id'], 'thumbnail', true); ?>
						<?php if(!empty($thumbMeta)) : ?>
							<img src="<?php echo CORE_TIMTHUMB_URL.get_post_meta($post['id'], 'thumbnail', true)."&w=215&h=100";?>" alt="<?php echo $post['title']; ?>">
						<?php else : ?>
						<img src="<?php echo CORE_TIMTHUMB_URL.CORE_THEME_IMAGE."no-image.jpg&w=215&h=150";?>" alt="<?php echo $post['title']; ?>">
						<?php endif; ?>
					<?php endif; ?>
					<p><?php echo limitWord($post['content'],150); ?> <a href="<?php echo $post['permalink']; ?>">Xem thêm</a></p>
				</div>
				<!-- /.reviewInfo -->

				<?php 
					$hostingReviews = get_post_meta($post['id'],'review-hosting',true);
					$hostingReviews = explode(";",$hostingReviews);
					$review_support = get_post_meta($post['id'],'review-support',true);
					$review_properties = get_post_meta($post['id'],'review-properties',true);
					$review_download = get_post_meta($post['id'],'review-download',true);
					$review_upload = get_post_meta($post['id'],'review-upload',true);
					$review_desert = get_post_meta($post['id'],'review-desert',true);
				?>
				<div class="reviewFeatured floatLeft">
					<?php if(count($hostingReviews)>1) : ?>
					<h4>Tính năng</h4>
					<ul>
						<?php foreach($hostingReviews as $key=>$review) : ?>
							<?php if(!empty($review)) : ?>
								<li><?php echo $review; ?></li>
							<?php endif; ?>
						<?php endforeach; ?>
					</ul>
					<?php else : ?>
					<h4>Không có tính năng</h4>
					<?php endif; ?>
				</div>
				<!-- /.reviewFeatured -->
				<div class="reviewRate floatRight">
					<?php if(!empty($review_support) && !empty($review_desert)) : ?>
					<h4>Đánh giá</h4>
					<ul>
						<li>
							<span>Hỗ trợ KH</span>
							<div class="rating">
								<progress value="<?php echo (int)$review_support; ?>" max="100"></progress>
								<span class="reviewStatus">Tồi</span>
							</div>
						</li>
						<li>
							<span>Tính năng</span>
							<div class="rating">
								<progress value="<?php echo (int)$review_properties; ?>" max="100"></progress>
								<span class="reviewStatus">Đầy đủ</span>									
							</div>
						</li>
						<li>
							<span>Download</span>
							<div class="rating">
								<progress value="<?php echo (int)$review_download; ?>" max="100"></progress>
								<span class="reviewStatus">Nhanh</span>
							</div>
						</li>
						<li>
							<span>Upload</span>
							<div class="rating">
								<progress value="<?php echo (int)$review_upload; ?>" max="100"></progress>
								<span class="reviewStatus">Chậm</span>
							</div>
						</li>
						<li>
							<span>Giá trị</span>
							<div class="rating">
								<progress value="<?php echo (int)$review_desert; ?>" max="100"></progress>
								<span class="reviewStatus">Tuyệt vời</span>
							</div>
						</li>
					</ul>
					<?php else : ?>
					<h4>Chưa được đánh giá</h4>
					<?php endif; ?>
					<div class="viewMoreReview"><a href="<?php echo $post['permalink']; ?>">Gửi đánh giá của bạn</a></div>
				</div>
				<!-- /.reviewRate -->
				<div class="clearfix"></div>
			</div>
			<!-- /.lastItems -->
			<?php else : ?>
			<div id="newItem-<?php echo $post['id']; ?>" class="lastItems">
				<div class="postImg floatLeft">
					<a href="<?php echo $post['permalink']; ?>">
						<?php if(has_post_thumbnail($post['id'])) : ?>
							<?php $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post['id']),'full'); ?>
							<img src="<?php echo CORE_TIMTHUMB_URL.$thumb[0]."&w=215";?>" alt="<?php echo $post['title']; ?>">
					<?php else : ?>
						<?php $thumbMeta = get_post_meta($post['id'], 'thumbnail', true); ?>
						<?php if(!empty($thumbMeta)) : ?>
							<img src="<?php echo CORE_TIMTHUMB_URL.get_post_meta($post['id'], 'thumbnail', true)."&w=215";?>" alt="<?php echo $post['title']; ?>">
						<?php else : ?>
						<img src="<?php echo CORE_TIMTHUMB_URL.CORE_THEME_IMAGE."no-image.jpg&w=215&h=150";?>" alt="<?php echo $post['title']; ?>">
						<?php endif; ?>
					<?php endif; ?>
					</a>
					<div class="tag">
						<?php foreach($post['categories'] as $category) : ?>
							<a href="<?php echo $category['link'] ?>">#<?php echo $category['name']; ?></a>
						<?php endforeach; ?>
					</div>
					<!-- /.tag -->
				</div>
				<!-- /.postImg -->
				<div class="postDescription floatRight">
					<h1><a href="<?php echo $post['permalink']; ?>"><?php echo $post['title']; ?></a></h1>
					<ul>
						<li class="author"><a href="<?php echo $post['author']['link']; ?>"><?php echo $post['author']['name']; ?></a></li>
						<li class="time"><?php echo $post['date']; ?></li>
						<li class="comments"><a href="<?php echo $post['permalink']; ?>#disqus_thread"><?php echo $post['comments']; ?> comments</a></li>
					</ul>
					<p><?php echo $post['excerpt']; ?></p>
				</div>
				<!-- /.postDescription -->
				<div class="clearfix"></div>
			</div>
			<?php endif; ?>
			<!-- /.lastItems -->
		<?php endforeach; ?>
		<?php wp_pagenavi(); ?>
	</section>
	<!-- /#lastestPost.floatLeft -->
	<?php $this->sidebar(); ?>
	<div class="clearfix"></div>
</article>
<!-- /#mainContent.wrapper -->